Reduce garbage from allocations in DeprecationLogger#38780
Merged
ebadyano merged 2 commits intoelastic:masterfrom Feb 22, 2019
Merged
Reduce garbage from allocations in DeprecationLogger#38780ebadyano merged 2 commits intoelastic:masterfrom
ebadyano merged 2 commits intoelastic:masterfrom
Conversation
1. Setting length for formatWarning String to avoid AbstractStringBuilder.ensureCapacityInternal calls 2. Adding extra check for parameter array length == 0 to avoid unnecessarily creating StringBuilder in LoggerMessageFormat.format Relates to elastic#37530 Relates to elastic#37411
Collaborator
|
Pinging @elastic/es-core-infra |
Member
danielmitterdorfer
left a comment
There was a problem hiding this comment.
I left two nits but the actual changes look fine to me. Can you please also:
- Update the PR title so it better reflects the purpose of the change, e.g. "Reduce garbage in deprecation logger" gives readers a much better understanding what this change is about than a more generic title.
- Update the PR description to indicate how much we gain from that?
| */ | ||
| public static String formatWarning(final String s) { | ||
| return WARNING_PREFIX + " " + "\"" + escapeAndEncode(s) + "\""; | ||
|
|
Member
There was a problem hiding this comment.
Nit: remove empty line.
| return null; | ||
| } | ||
| if (argArray == null) { | ||
| if ((argArray == null) || (argArray.length == 0)) { |
Member
There was a problem hiding this comment.
Nit: remove redundant parentheses.
Contributor
Author
|
@danielmitterdorfer Thank you for the review! |
ebadyano
added a commit
to ebadyano/elasticsearch
that referenced
this pull request
Feb 25, 2019
1. Setting length for formatWarning String to avoid AbstractStringBuilder.ensureCapacityInternal calls 2. Adding extra check for parameter array length == 0 to avoid unnecessarily creating StringBuilder in LoggerMessageFormat.format Helps to narrow the performance gap in throughout for geonames benchmark (elastic#37411) by 3%. For more details: elastic#37530 (comment) Relates to elastic#37530 Relates to elastic#37411 Relates to elastic#35754
ebadyano
added a commit
that referenced
this pull request
Feb 25, 2019
1. Setting length for formatWarning String to avoid AbstractStringBuilder.ensureCapacityInternal calls 2. Adding extra check for parameter array length == 0 to avoid unnecessarily creating StringBuilder in LoggerMessageFormat.format Helps to narrow the performance gap in throughout for geonames benchmark (#37411) by 3%. For more details: #37530 (comment) Relates to #37530 Relates to #37411 Relates to #35754
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Helps to narrow the performance gap in throughout for geonames benchmark (#37411) by 3%. For more details: #37530 (comment)
Relates to #37530
Relates to #37411
Relates to #35754